﻿using HandyControl.Controls;
using HandyControl.Data;
using HandyControl.Tools.Extension;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WcsZz.Extend;
using wms_wpf.DialogView;
using wms_wpf.ViewModels;
using ComboBox = System.Windows.Controls.ComboBox;
using MessageBox = System.Windows.MessageBox;

namespace wms_wpf.Views
{
    /// <summary>
    /// BoxConfigView.xaml 的交互逻辑
    /// </summary>
    public partial class BoxConfigView : UserControl
    {
        public BoxConfigView()
        {
            InitializeComponent();





        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            HandyControl.Controls.Dialog.Show(new Dialog2());
        }
        Dialog Dialog=new Dialog();
        private async void Button_Click_1(object sender, RoutedEventArgs e)
        {

            Dialog = Dialog.Show<Dialog3>();

        }
    
        private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
        {
            short val;
            if (!Int16.TryParse(e.Text, out val))
                e.Handled = true;
        }
        private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Space)
                e.Handled = true;
        }
        private void DgSceneRecord_LoadingRow(object sender, DataGridRowEventArgs e)
        {
            if (Index.PageIndex == 1)
            {
                e.Row.Header = e.Row.GetIndex() + 1;
            }
            else
            {
                e.Row.Header = (e.Row.GetIndex() + 1) + (Index.PageIndex - 1) * Convert.ToInt32(Combobox.Text);
            }
        }
        private void Pagination_PageUpdated(object sender, FunctionEventArgs<int> e)
        {

            string b = Convert.ToString(e.Info);



        }
        private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBox comboBox = (ComboBox)sender;
            ComboBoxItem selectedItem = comboBox.SelectedItem as ComboBoxItem;
            if (selectedItem != null)
            {
                // 获取ComboBox选中项的值
                string selectedValue = selectedItem.Content.ToString();
                // TODO: 处理ComboBox选中项的值


            }

        }
        private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            if(BoxCodeText.Text.Length>=10) 
            {
                
                    //EventAggregatorHelper.EventAggregator.SendMessage(BoxCodeText.Text, "GetList_Boxs");
            

            }
        }
    }
}
